home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / lisp / elk-2_0.lha / elk-2.0 / contrib / zelk / src-zelk / rtltest.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-11-13  |  989 b   |  42 lines

  1. /* rtltest.c - sample, test, and template of a 'foreign library'
  2.  * mod
  3.  * 12nov
  4.  */
  5.  
  6. #include <rtlpkg.h>
  7.  
  8. /*%%%%%%%%%%%%%%%% entries %%%%%%%%%%%%%%%%*/
  9.  
  10. #define FDEF_Mysub \
  11. {  "Mysub",    (vfunction *)Mysub,    "SRI", },
  12.  
  13. static int Mysub(s) char *s;
  14. {
  15.    int len = strlen(s);
  16.    printf("Mysub will return %d\n",len);
  17.    return len;
  18. } /*Mysub*/
  19.  
  20. /*%%%%%%%%%%%%%%%% scheme link %%%%%%%%%%%%%%%%*/
  21.  
  22. local struct fordef ftab[] = {
  23.   FDEF_Mysub
  24.   0
  25. };
  26.  
  27. global FORPKG0 pkg_My = {
  28.     0,                    /*packagetype. 0=current*/
  29.     (int (*)())0,            /*init_*/
  30.     0,                    /*stab,*/
  31.     (struct fordef *)ftab,        /*ftab,*/
  32.     (struct fordef_usage *)0        /*futab,*/
  33. };
  34.  
  35. /* nov/92 - when this .o file is loaded, the routine below
  36.    will be called; it returns the address of the table containing
  37.    information to link the C routines in this file to scheme.
  38.    There are no references to elk internals, however,
  39.    so this file can also be used as an ordinary C library. 
  40.  */
  41. FORPKG0 *PKGrtn_My() { return &pkg_My; }
  42.